<template>
  <div class="collection">
    <van-nav-bar
      title="收藏页"
      left-text="返回"
      right-text=". . ."
      left-arrow
      @click-left="$router.back()"
    />
     <div class="hotel" v-for="(item,index) in $store.state.collectionList" :key="index" @click="godetail(item)">
        <div class="left">
            <img v-lazy="item.picUrl" alt="">
        </div>
        <div class="right">
            <div class="name">
                <h2>{{item.name}}</h2>
            </div>
            <div class="score">
                <van-icon name="star" />
                <span>{{item.averagePriceTip}}</span>
                <span>{{item.monthSalesTip}}</span>
            </div>
            <div class="price">
                <div class="lefts">
                    <span>{{item.minPriceTip}}</span>
                    <span>{{item.shippingFeeTip}}</span>
                </div>
                <div class="rights">
                    <span>{{item.deliveryTimeTip}}</span>
                    <span>{{item.distance}}</span>
                </div>
            </div>
            <ul>
                <li v-for="(v,i) in item.discounts2" :key="i">{{v.info}}</li>
            </ul>
        </div>
    </div>
    <div class="empty" v-if="$store.state.collectionList.length == 0">
        收藏页为空，<span @click="$router.push('/home')">快去逛逛吧！</span>
    </div>
  </div>
</template>

<script>
export default {
    methods:{
        godetail(id){
            this.$router.push({
                path:"/detail",
                query:{id:id.mtWmPoiId}
            })
        },
    }

}
</script>

<style lang="scss" scoped>
    .collection{
        .hotel{
            display: flex;
            margin:20px 0;
            // background: pink;
            .left{
                width: 110px;
                margin-right: 15px;
                img{
                    width: 100%;
                    height: 100px;
                    margin-top: 10px;
                }
            }
            .right{
                flex: 1;
                display: flex;
                flex-direction: column;
                h2{
                    font-size: 18px;
                    font-weight: 600;
                    margin-bottom: 15px;
                }
                .score{
                    font-size: 15px;
                    color: orangered;
                    margin-bottom: 8px;
                    .van-icon{
                        margin-right: 3px;
                    }
                    span:last-child{
                        margin-left: 10px;
                        color: #666;
                    }
                }
                .price{
                    display: flex;
                    justify-content: space-between;
                    font-size: 14px;
                    color: #666;
                    margin-bottom: 10px;
                    .lefts{
                        span:first-child{
                            margin-right: 8px;
                        }
                    }
                    .rights{
                        span:first-child{
                            margin-right: 5px;
                        }
                    }
                }
                ul{
                    display: flex;
                    flex-wrap: wrap;
                    li{
                        font-size: 12px;
                        color: red;
                        padding: 0 3px;
                        margin: 5px 5px 0 0;
                        border: 1px solid pink;
                        border-radius: 2px;
                    }
                }
            }
        }
        .empty{
            text-align: center;
            padding: 100px 0;
            span{
                color: lightskyblue;
                text-decoration: underline;
            }
        }
    }
</style>